home *** CD-ROM | disk | FTP | other *** search
- /*
- File: UnitTableDriveQSupport.h
-
- Contains: All drive queue and Volume queue specific functions
-
- Version: 1.0
-
- Copyright: © 1998-1999 by Apple Computer, Inc., all rights reserved.
-
- */
-
- #pragma once
-
- #include <MacTypes.h>
- #include <Disks.h>
- #include <Files.h>
-
- #include "UnitTableDeviceAccess.h" // Needed for ControlStatusCompletionProcPtr structure
- #include "UnitTableDriverIcons.h" // Needed for DiskIcon structure
-
- // The blocksize that all file system requests are based on
- enum
- {
- kFileSystemRequestBlockSize = 0x00000200L
- };
-
- // The control/status call definitions for Utility Mode
- enum
- {
- kdgDriverUtilitySupport = 'util', // For right now, this DriverGestalt will return true if the following
- // calls are supported. The final version of this call will actually
- // set attribute flags to indicate which uility features it supports
-
- kcsSetDriverMode = 600, // Control call for switching between Normal/Utility mode
- kcsGetDriverMode = 600, // Status call for querying current driver mode
-
- // Definitions for the modes These are passed in csParam[0].
- kDriverModeNormal = 1,
- kDriverModeUtility = 2,
-
- kcsManageReadOnlyMediaQueue = 601,
- // Definitions Read Only Media queue management. These are passed in in csParam[0]
- kReadOnlyMediaQueueInstall = 1, // If installed without errors, the DriveNum is returned in csParam[1]
- kReadOnlyMediaQueueRemove = 2
- };
-
- // Media icon/string structure format
- struct MediaIconStruct
- {
- SInt8 mediaIcon[256]; // ICN# data is 256 bytes
- Str255 mediaWhereString; // returned in C string format
- };
- typedef struct MediaIconStruct MediaIconStruct;
-
- // This structure defines each physical drive…
- struct DriveQRec
- {
- // Drive Queue information
- DrvSts2 driveStatus; // drive status info & queue element
- UInt16 driveNum; // Position in the Drive Queue
-
- // Physical drive characteristics retreived from the DAM
- UInt32 capacity; // Drive capacity in native device blocks
- UInt32 blockSize; // Drive's native block size
- OSType deviceType; // The type of device represented.
- Boolean isWriteProtected; // The DAM indicated that this device is write protected
-
- // Partition characteristics from the media
- UInt32 partMapEntryNum; // Block number of the PMap entry for this partition. Zero means not in a PMap.
- // The next three fields are only vaild if there is a PMap entry for this partition.
- Boolean mountPartition; // true = Mount Partition bit was set in the partition status field of the PMap
- /* Boolean startupPartition; // true = Startup bit was set in the partition status field of the PMap*/
- Boolean writeProtectedPart; // true = Write protect bit was set in the partition status field of the PMap
-
- // DriveQRec status fields derived by driver
- Boolean isValidRecord; // Indicates if this record is being used
- Boolean isPermanentQElement; // Indicates if this should be removed from driveQ on eject
- Boolean isFloppy; // This DriveQRec is for floppy media - usage should be replace with the deviceType field
- Boolean diskInsertPosted; // true = a Disk Insert event has successfully been posted for this partition.
- Boolean inDriveQ; // true = this partition is in the drive Q
- UInt32 partitionNo; // the partition number for the volume
- UInt32 partoffset; // phys. offset of data partition in system size blocks
- UInt32 curoffset; // 0 = physical mapping, else 'partoffset'
- UInt32 partblks; // number of blocks in the partition in system size blocks
- Ptr nextVol; // Link to next volume in the list
- Ptr mediaIconPtr; // Pointer to the media icon for this volume
- };
-
- typedef struct DriveQRec DriveQRec, *DriveQRecPtr;
-
- // Install Drive. The routine that will scan media and install drive queue elements as needed
- // Completion routine type for InstallDrive routine
- typedef CALLBACK_API_C( void , DriveInstallCompletionProcPtr )( Boolean wasSuccessful );
- extern void InstallDrive( DriveInstallCompletionProcPtr completionProc );
-
- // Prototypes for the routines used by Initialize and Terminate
- extern OSStatus InstallDriveQueueElement( DriverRefNum theDrvrRefNum );
- extern OSStatus RemoveDriveQueueElement( void );
-
- // If these routines return any OSStatus except Request Pending, then the callback routine will not be called
- extern OSStatus DriveQueueControlCallSupport( UInt32 userData, CntrlParamPtr cntrlPBPtr, ControlStatusCompletionProcPtr callBack );
- extern OSStatus DriveQueueStatusCallSupport( UInt32 userData, CntrlParamPtr cntrlPBPtr, ControlStatusCompletionProcPtr callBack );
-
- // Prototypes for DriveQueue query routines
- extern Boolean IsDriveNumberValid( UInt16 driveNum );
- extern Boolean IsDriveNumWriteProtected( UInt16 driveNum );
- extern Boolean AreThereMountedDrives( void );
- extern UInt32 GetNumberOfVolumes( void );
- extern void GetMediaIconForDriveNum( UInt16 driveNum, DiskIcon *iconPtr );
- extern void GetDriveStatusForDriveNum( UInt16 driveNum, DrvSts *statusPtr );
- extern OSType GetMediaTypeForDriveNum( UInt16 driveNum );
-
- // Prototypes for routines to find a DriveQRec
- extern DriveQRecPtr FindDriveQRecForDriveNum( UInt16 driveNum );
- extern DriveQRecPtr FindDriveQRecForPartitionNum( UInt32 partNum );
- extern DriveQRecPtr GetFirstDriveQRec( void );
- extern DriveQRecPtr GetNextDriveQRec( DriveQRecPtr theDriveQRec );
-
- // Routines for managing the state of a DriveQRec
- extern void EjectDriveNum( UInt16 driveNum );
- extern SInt16 NextQDrive( void );
- extern void UpdateQ(SInt16 qDrive, SInt32 newSize);
- extern SInt32 NextPartitionID( void );
-
- extern DriveQRecPtr CreateNewDriveQRecForPartition( UInt32 partitionID, UInt32 partitionSize, UInt32 partitionOffset );
-
- // These should only be used by the media specific support modules (CD or Floppy) to manage its DriveQRec
- extern DriveQRecPtr GetNewDriveQRec( void );
- extern void FreeDriveQRec( DriveQRecPtr theDriveRecPtr );
- extern void NativeAddDrive(DriverRefNum drvrRefNum, UInt16 driveNumber, DrvQElPtr drvQEl);
- extern void RemoveDrive(DriveQRecPtr theDrivePtr);
- extern Boolean IsDriveQueueNumberFree( UInt16 driveNum );
-
-